package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MinioPropertites.class)
//@ConfigurationPropertiesScan("com.atguigu.lease.common.minio")
public class MinioConfiguration {

    @Autowired
    private MinioPropertites propertites;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder().endpoint(propertites.getEndpoint()).credentials(propertites.getAccessKey(), propertites.getSecretKey()).build();
    }
}
